﻿<script type="text/javascript">
{literal}
function SelectAll(mark)
{
	for (i = 0; i < document.forms['main'].elements.length; i++)
	{
		var item = document.forms['main'].elements[i];
			if (item.name == "id[]")  {item.checked = mark;};
	}
	return false;
}
function DeleteSelected()
{
	if (confirm("Вы уверены, что хотите удалить выделенные строки?"))
	{
		document.forms['main'].submit();
	}
	return false;
}
{/literal}
</script>

{if $smarty.get.pageNum neq null}
{assign var="p" value=$smarty.get.pageNum-1}
	{gallery action=GETALLGALS varname="gals" start=$p*20 count=20}
{else}
{assign var="p" value=0}
	{gallery action=GETALLGALS varname="gals" start=0 count=20}
{/if}
{gallery action=GETGALSCNT varname="cnt"}
Всего галерей: {$cnt}<br>
{pager urlVar="pageNum" perPage="20" totalItems=$cnt varname="pager"}
<div align="center">{$pager[0].all}</div>
<form action="index.php?module=gallery&action=delgal" name="main" method="post">
<div class="cp-btns"><a href="index.php?module=gallery&action=addgal">Добавить</a> <a onclick="return DeleteSelected()" href="">Удалить</a></div>
<table border="0" class="rows"  cellpadding="1" cellspacing="1">
<tr>
<th><input type="checkbox" type="checkbox" onclick="SelectAll(checked)"></th>
<th>#</th>
<th>Название</th>
<th>Описание</th>
</tr>

{section name=acmp loop=$gals}
<tr class="{if ($smarty.section.acmp.index is not odd) }oddRow{else}evenRow{/if}">
<td><input type="checkbox" name="id[]" value="{$gals[acmp].id}"></td>
<td><a href="index.php?module=gallery&action=editgal&id={$gals[acmp].id}">{$gals[acmp].id}</a></td>
<td><a href="index.php?module=gallery&action=editgal&id={$gals[acmp].id}">{$gals[acmp].name}</a></td>
<td>{$gals[acmp].shortDescription}</td>
</tr>
{/section}
</table>
<div align="center">{$pager[0].all}</div>
Всего галерей: {$cnt}<br>
</form>
{literal}
<script>
if (window.opener!=null)
{
	window.opener.PageLoaded(window,'gallery');
}
else if (window.parent!=null)
{
	window.parent.PageLoaded(window,'gallery');
}
</script>
{/literal}